<?php $this->beginContent('//layouts/main'); ?>
<div class="navbar">
	<div class="navbar-inner">
		<div class="container">
			<?php echo CHtml::link(CHtml::image(Utils::getImageUrlById("common", "", "home"),Yii::app()->name),array("site/index"),array("class"=>'brand'))?>
			<?php echo CHtml::link(Yii::app()->name,array("site/index"),array("class"=>'brand'))?>
			<div class="nav-collapse">
				<?php
				$this->widget('zii.widgets.CMenu', array(
						'items'=>array(
								array('label'=>'首页', 'url'=>array('site/index')),
								array('label'=>'关于', 'url'=>array("site/page","view"=>'about')),
								array('label'=>'联系', 'url'=>array('site/contact')),
						),
						'htmlOptions'=>array("class"=>'nav'),
				));
				?>

				<ul class="nav pull-right">
					<?php if(Yii::app()->user->isGuest):?>
					<li><?php echo CHtml::link('<i class="icon-user icon-white"></i>登陆',array("site/login"));?>
					</li>
					<li><?php echo CHtml::link('<i class="icon-plus icon-white"></i>注册',array("site/register"));?>
					</li>
					<?php else:?>
					<?php $member=Member::model()->findByPk(Yii::app()->user->id); ?>
					<li><?php echo CHtml::link('<i class="icon-user icon-white"></i> 您的主页',array("member/index","username"=>Yii::app()->user->name))?>
					</li>
					<li><?php echo CHtml::link('<i class="icon-minus icon-white"></i>退出',array("site/logout"));?>
					</li>
					<!--

				  <li class="dropdown" id="menu1">
					<a class="dropdown-toggle" data-toggle="dropdown" href="#menu1"> 普通会员:<?php echo $member->title;?><b class="caret"></b> </a>
					<ul class="dropdown-menu">
						<li><a href="<?php echo $this->createUrl('/member/profile');?>">个人资料</a></li>
						<li><a href="<?php echo $this->createUrl('/member/update');?>">更新资料</a></li>
						<li><a href="<?php echo $this->createUrl('/member/password');?>">修改密码</a></li>
						<li><a href="<?php echo $this->createUrl('/member/myevents');?>">我的活动</a></li>
						<li class="divider"></li>
						<?php echo CHtml::link('<i class="icon-minus icon-white"></i>退出',array("site/logout"));?>
					</ul>
				  </li>
  					-->

					<?php endif;?>
				</ul>
			</div>
			<!--/.nav-collapse -->
		</div>
	</div>
</div>
<div class="container">
	<div class='row'>
		<div class="span3">
			<div class="div div-plain">
				<?php 
				$navs = array(array("label"=>"活动分类","url"=>"#","linkOptions"=>array("class"=>"nav-header")));
				$criteria = new CDbCriteria();
				$criteria->order = 'seq asc';
				$categories = Category::model()->findAll($criteria);
				foreach ($categories as $category){
					array_push($navs,array("label"=>"<i class='icon-{$category->description} icon-black'></i> $category->title",'url'=>array("site/index","category_id"=>$category->id)));
				}
				$this->widget('zii.widgets.CMenu', array(
						'items'=>$navs,
						'encodeLabel'=>false,
						'htmlOptions'=>array("class"=>'nav nav-list'),
				));
				?>

			</div>
			<div class="div div-plain sidebar-nav">

				<!-- ----------------Member list --------------------->
				<?php 
				$criteria2 = new CDbCriteria();
				$criteria2->order = "created desc";
				$criteria2->limit = 12;
				$members = Member::model()->findAll($criteria2);
					foreach ($members as $member):?>
				<div style='padding: 2px' class='pull-left'>
					<?php 
					$avatar = CHtml::image(Utils::getImageUrlById("avatar", "thumbnail", $member->id),'',array("style"=>'height:55px;width:55px'));
					echo CHtml::link($avatar,array("member/index","username"=>$member->username));
					?>
				</div>
				<?php endforeach;?>
				<div style='clear: both'></div>
			</div>
			<div class="div div-plain sidebar-nav">
				<?php 
				$criteria = new CDbCriteria();
				$criteria->order = 'seq asc';
				$links = Link::model()->findAll($criteria);
				foreach ($links as $link){
					echo "<a target='_blank' href='$link->url'><img src='$link->logo' alt='$link->title'/></a>";
				}
				?>
			</div>
			<!--/.well -->
		</div>
		<!--/span-->


		<div class="span9">

			<?php echo $content?>

			<!--/span-->
			<!--/row-->
		</div>
	</div>
	<!--/span-->
</div>
<?php $this->endContent(); ?>
